FROM ubuntu:24.04

LABEL auth="zhangxin,1367800014@qq.com,mao-cloud"
ADD *.sh /root/
ADD settings.xml /root/.m2/settings.xml

ENV LANG="zh_CN.UTF-8"
ENV LANGUAGE="zh_CN:zh:en_US:en"
ENV ROOT_PASSWD="1229"
ENV NVM_DIR="/root/.nvm"

RUN sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/ubuntu.sources && \
    sed -i 's/security.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/ubuntu.sources && \
    ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
    echo "Asia/Shanghai" > /etc/timezone && \
    apt update && apt remove openjdk-* -y && apt install language-pack-zh-hans vim net-tools lsof cron openssh-server nginx curl openjdk-17-jdk git maven coreutils unzip zip -y && \
    sed -i 's/#Port/Port/g' /etc/ssh/sshd_config && \
    sed -i 's/#ListenAddress/ListenAddress/g' /etc/ssh/sshd_config && \
    sed -i 's/#PermitRootLogin/PermitRootLogin/g' /etc/ssh/sshd_config && \
    sed -i 's/prohibit-password/yes/g' /etc/ssh/sshd_config && \
    chmod 755 /root/*.sh && /root/install.sh && rm -rf /root/install.sh && \
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && nvm install --lts 14 && nvm install --lts 16 && nvm install --lts 20 && npm config set registry https://registry.npmmirror.com && \
    apt upgrade -y && apt autoremove -y && apt autoclean

EXPOSE 22/tcp 80/tcp

ENTRYPOINT [ "/root/init.sh" ]